/* GTK - The GIMP Toolkit
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * Author: Thura Hlaing <trhura@gmail.com>
 *
 */

#include <string.h>

#include <gdk/gdkkeysyms.h>
#include <gdk/gdkkeys.h>
#include "gtkimcontextbur.h"
#include "callbacks.h"

static void     gtk_im_context_burmese_class_init			(GtkIMContextBurmeseClass *class);
static void     gtk_im_context_burmese_init					(GtkIMContextBurmese      *im_context_burmese);
static gboolean gtk_im_context_burmese_filter_keypress		(GtkIMContext             *context,
															 GdkEventKey              *key);
static GObjectClass *parent_class;

GType gtk_type_im_context_burmese = 0;

void
gtk_im_context_burmese_register_type (GTypeModule *type_module)
{
	static const GTypeInfo im_context_burmese_info =
		{
			sizeof (GtkIMContextBurmeseClass),
			(GBaseInitFunc) NULL,
			(GBaseFinalizeFunc) NULL,
			(GClassInitFunc) gtk_im_context_burmese_class_init,
			NULL,           /* class_finalize */    
			NULL,           /* class_data */
			sizeof (GtkIMContextBurmese),
			0,
			(GInstanceInitFunc) gtk_im_context_burmese_init,
		};

	gtk_type_im_context_burmese = 
		g_type_module_register_type (type_module,
									 GTK_TYPE_IM_CONTEXT,
									 "GtkIMContextBurmese",
									 &im_context_burmese_info, 0);
}

static void
gtk_im_context_burmese_class_init (GtkIMContextBurmeseClass *class)
{
  GtkIMContextClass *im_context_class = GTK_IM_CONTEXT_CLASS (class);

  parent_class = g_type_class_peek_parent (class);

  im_context_class->filter_keypress = gtk_im_context_burmese_filter_keypress; 
}

static void
gtk_im_context_burmese_init (GtkIMContextBurmese *im_context_burmese)
{
	im_context_burmese->third_level_on = FALSE;
	im_context_burmese->surrounding_text = NULL;
}

GtkIMContext * gtk_im_context_burmese_new (void)
{
  GtkIMContextBurmese *result;

  result = GTK_IM_CONTEXT_BURMESE (g_object_new (GTK_TYPE_IM_CONTEXT_BURMESE, NULL)); 
  return GTK_IM_CONTEXT (result);
}

static gboolean gtk_im_context_burmese_filter_keypress (GtkIMContext *context,
                                        GdkEventKey  *event)
{
  GtkIMContextBurmese *context_burmese = GTK_IM_CONTEXT_BURMESE (context);
  
  return callback_handle_keypress (context_burmese, event);
} 
